/*
 * Alberto De Pena
 * Applied Algorothms
 * anagrams.cpp
 */
#include <fstream>
#include <string>
#include <queue>

using namespace std;

void main()
{
	ifstream fin( "anagrams.in" );
	ofstream fout( "anagrams.out" );

	priority_queue<char> string1, string2;

	string str1, str2;
	getline( fin, str1 );
	getline( fin, str2 );
	while( str1 != "<end>" && str2 != "<end>" )
	{
		for( int i = 0; i < str1.length(); i++ )
		{
			if( isalpha( str1[i] ))
			{
				str1[i] = toupper( str1[i] );
				string1.push( str1[i] );
			}
		}

		for( int i = 0; i < str2.length(); i++ )
		{
			if( isalpha( str2[i] ))
			{
				str2[i] = toupper( str2[i] );
				string2.push( str2[i] );
			}
		}

		bool isanagram = true;

		if( string1.size() != string2.size() )
			isanagram = false;

		while( isanagram && !string1.empty() && !string2.empty() )
		{
			if( string1.top() != string2.top() )
				isanagram = false;
			else
			{
				string1.pop();
				string2.pop();
			}
		}
		
		while( !string1.empty() )
			string1.pop();

		while( !string2.empty() )
			string2.pop();
		
		if( isanagram )
			fout << "YES" << endl;
		else
			fout << "NO" << endl;

		getline( fin, str1 );
		getline( fin, str2 );
	}

	fin.close();
	fout.close();
}